package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.SystemEventLog;
import com.group.project.hrms.mapper.SystemEventLogMapper;
import com.group.project.hrms.service.ISystemEventLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.Date;
import java.util.List;

@Service
public class SystemEventLogService implements ISystemEventLogService {

    @Autowired
    private SystemEventLogMapper systemEventLogMapper;

    @Override
    public int insertSystemEventLog(SystemEventLog systemEventLog) {
        return systemEventLogMapper.insert(systemEventLog);
    }

    @Override
    public List<SystemEventLog> selectSystemEventLogs(Date startDate, Date endDate) {
        Example example = new Example(SystemEventLog.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andGreaterThanOrEqualTo("cTime", startDate);
        criteria.andLessThanOrEqualTo("cTime", endDate);
        return systemEventLogMapper.selectByExample(example);
    }
}
